home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
c
/
vbccm68k.lha
/
vbcc
/
doc
/
building.doc
next >
Wrap
Text File
|
1999-03-07
|
6KB
|
190 lines
vbcc - C compiler (c) in 1995-99 by Volker Barthelmann
INTRODUCTION
vbcc is a free portable and retargetable ANSI C compiler.
It is split into a target independant and a target dependant part and
supports emulating datatypes of the target machine on any other machine
so that it is possible to e.g. make a crosscompiler for a 64bit machine
on a 32bit machine.
This document only deals with building vbcc from the source.
Be sure to read all the documents for your machine.
LEGAL
vbcc is (c) in 1995-99 by Volker Barthelmann. The builtin preprocessor
(consisting of the files preproc.c and vbpp.h) is written and (c) by
Thorsten Schaaps. All other code is (c) by Volker Barthelmann.
vbcc may be freely redistributed as long as no modifications are made
and nothing is charged for it.
Non-commercial usage of vbcc is allowed without any restrictions.
Commercial usage needs my written consent.
Sending me money, gifts, postcards etc. would of course be very nice
and may encourage further development of vbcc, but is not legally or
morally necessary to use vbcc.
DIRECTORY-STRUCTURE
The vbcc-directory contains the following important files and
directories:
vbcc/ The main directory.
vbcc/Makefile The Makefile used to build vbcc.
vbcc/frontend/ Directory containing the source to vc.
vbcc/vcpp/ Directory containing source to vcpp.
vbcc/vsc/ Directory containing source to vsc.
vbcc/machines/target/ Directory for <target>.
vbcc/bin/ Directory the executables will be placed in.
All compiling is done from the main directory.
The preprocessor vcpp and the frontend vc are not target-dependant
and therefore only one version of them is created.
Every available target has at least one subdirectory with its name in
vbcc/ and contains at least the files machine.h, machine.c and
machine.dt. Target-specific object-files will also be stored in that
directory.
The executables will be placed in vbcc/bin/. The main compiler will
be called vbcc<target>.
ADAPTING THE MAKEFILE
Before building anything you have to insert correct values for CC, NCC,
LDFLAGS and NLDFLAGS in the Makefile.
CC Here you have to insert a command that invokes an ANSI C
compiler you want to use to build vbcc. It must support
-D, -I, -c and -o the same like e.g. vc or gcc.
Additional options should also be inserted here. E.g. if you
are compiling for the Amiga with vbcc you should add -DAMIGA.
LDFLAGS Here you have to add options which are necessary for linking.
E.g. some compilers need special libraries for floating-point.
An example for the Amiga using vbcc would be:
CC = vbcc://bin/vc -DAMIGA
LDFLAGS = vbcc:libsrc/stdlib/newmalloc.o -lmieee -lextra
(newmalloc.o is just linked for performance and -lextra is needed
because vcpp unfortunately uses certain non-ANSI-functions.)
An example for a typical Unix-installation would be:
CC = cc
LDFLAGS = -lm
NCC and NLDFLAGS are similar to CC and LDFLAGS but they must always
describe a native compiler, i.e. Programs compiled with NCC/NLDFLAGS
must be executable on the host system. This is needed because during
the build programs may have to be executed on the host.
BUILDING vc
Type:
make bin/vc
BUILDING vcpp
Type:
make bin/vcpp
BUILDING vsc
Type:
make TARGET=<target> bin/vsc<target>
E.g.:
make TARGET=alpha bin/vscalpha
Omit this step if there is no file machines/<target>/schedule.c.
BUILDING vbcc
Type:
make TARGET=<target> bin/vbcc<target>
E.g.:
make TARGET=alpha bin/vbccalpha
During the build the program dtgen will be generated and executed on
the host-system. First it will ask you whether you are building a
cross-compiler.
Answer 'y' only if you are building a cross-compiler (i.e. a compiler
which does not produce code for the same machine it it running on).
Note that it does _not_ matter if you are cross-building a compiler,
i.e. if you are running on system A and building a B->B compiler
by using an A->B compiler then you can answer 'n'.
If you answered 'y' you will be asked if your system/compiler offers
certain datatypes. This refers to the compiler you described with
CC in the Makefile.
E.g. if CC is an A->B cross-compiler you have to answer the questions
according to B.
To each question answer 'y' or 'n' depending if such a datatype is
available on that compiler. If you answered 'y' you have to type in
the name of that type on the compiler (e.g. "signed int", "unsigned
char" etc.).
If there are not enough datatypes available to build vbcc an error
message will be printed and the build aborts.
CONFIGURING
See vc.doc, vsc<target>.doc and vbcc<target>.doc for information on
how to create the necessary config-files.
BUILDING CROSS-COMPILERS
As there is often confusion when it comes to cross-building compilers
or building cross-compilers, here is what has to be done to cross-build
a B->C cross-compiler on system A with only a native A->A compiler
available.
This is done by first building an A->B compiler and then cross-building
the B->C compiler using the A->B compiler.
For the first step you use the A->A compiler for CC as well as NCC.
Now you type:
make bin/vc
make bin/vcpp
make TARGET=B bin/vscB # omit if there is no machines/B/schedule.c
make TARGET=B bin/vbccB
The questions about datatypes are answered according to A.
Then you should write a vc.config for the vbccB cross-compiler.
Now create a second directory containing all the sources to vbcc and
set CC/LDFLAGS to vc using the config-file for vbccB and NCC/NLDFLAGS
to the A->A compiler. Type:
make bin/vc
make bin/vcpp
make TARGET=C bin/vscC # omit if there is no machines/C/schedule.c
make TARGET=C bin/vbccC
Volker Barthelmann volker@vb.franken.de